<!--#include file="common_head.html"-->

<div class="dux-page-head">
    <div class="am-g am-g-fixed">
        <ol class="am-breadcrumb dux-page-crumb">
            <li><a href="/">首页</a></li>
            <!--loop{$pageInfo.crumb as $vo}-->
            <li><a href="{$vo.url}">{$vo.name}</a></li>
            <!--{/loop}-->
        </ol>
    </div>
</div>

<br>
<div class="dux-news-head am-g am-g-fixed">
    <img src="images/coupon-banner.jpg" alt="">
</div>
<br>

<div class="am-g am-g-fixed">

    <div class="am-tabs dux-page-tabs">
        <ul class="am-tabs-nav am-nav am-nav-tabs">
            <li class="{empty($type) ? 'am-active' : ''}"><a href="{url()}">全部</a></li>
            <!--loop{$typeList as $key => $vo}-->
            <li class="{$type==$key ? 'am-active' : ''}"><a href="{url('', ['type' => $key])}">{$vo.name}优惠券</a></li>
            <!--{/loop}-->
        </ul>
    </div>

    <ul class="dux-coupon-list am-avg-sm-3">
        <!--loop{$pageList as $vo}-->
        <li>
            <div class="dux-coupon-box">
                <div class="box-info">
                    <div class="line"></div>
                    <div class="name">
                        <!--if{$vo.exchange_price}-->
                        {$vo.exchange_price}{$vo.currencyInfo.name}兑换
                        <!--{else}-->
                        免费领取
                        <!--{/if}-->
                    </div>
                    <div class="subname">{$vo.name}</div>
                    <div class="btn">
                        <a href="javascript:;" class="receive" data-id="{$vo.coupon_id}">立即领取</a>
                    </div>
                    <div class="progress">
                        <div class="am-progress am-progress-xs">
                            <div class="am-progress-bar" style="width: 80%"></div>
                        </div>
                        <div class="tip">
                            <!--if{!stock}-->
                            已抢光
                            <!--{else}-->
                            已抢{round($vo.receive * $vo.stock / 100)}%
                            <!--{/if}-->
                        </div>
                    </div>
                </div>
                <div class="box-price">
                    <div class="money"><small>￥</small>{$vo.money}</div>
                    <div class="tip">满{$vo.meet_money}可用</div>
                </div>
            </div>
        </li>
        <!--{/if}-->
    </ul>

    <br>
    <div class="dux-page-pager">
        {$page}
    </div>


</div>


<!--#include file="common_footer.html"-->
<script>
    Do('base', function () {
        $('.receive').on('click', function () {
            var obj = this;
            app.ajax({
                url : "{url('receive')}",
                data : {
                    id : $(this).data('id')
                },
                success : function (msg) {
                    dialog.msg(msg);
                    $(obj).text('已领取').addClass('disable');
                },
                error : function (msg) {
                    dialog.msg(msg);
                }
            });

        });
    });
</script>
</html>